<!--
/*
 * SPDX-License-Identifier: GPL-3.0-or-later
 * Copyright 2014 The moOde audio player project / Tim Curtis
 * Copyright 2013 The tsunamp player ui / Andrea Coiutti & Simone De Gregori
 *
 * 汉化：Androidnews
 *
*/
-->
<div id="container">
<div class="container">
    <h1 class="snd-config">MPD</h1>

    <form class="form-horizontal" action="" method="post">
        <legend>设置
			<button class="legend-config btn btn-medium btn-primary btn-submit" type="submit" name="save" value="1" $_save_disabled>保存</button>
		</legend>
		<p class="sub-legend">
			MPD settings cannot be saved when Audio output in Bluetooth Control is set to "Bluetooth speaker" or when Multiroom Sender or Receiver are On.
		</p>

		<div class="control-group">

            <div class="config-horiz-rule">DSD支持</div>

            <label class="control-label" for="dsd-usb">格式</label>
            <div class="controls">
				<select id="dsd-usb" name="conf[dop]" class="config-select-large">
					$_mpd_select[dop]
				</select>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-dsd-audio" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
				<span id="info-dsd-audio" class="config-help-info">
					<b>Native DSD:</b>&nbsp;If the audio device reports that it supports Native DSD then MPD will send the unaltered DSD bitstream to the device otherwise MPD will perform DSD to PCM on-the-fly conversion.<br>
					<b>DSD over PCM (DoP):</b>&nbsp;There is no way to detect if an audio device supports DoP so only enable this if you are certain that the device support it otherwise the encapsulated DSD bitstream may cause loud or unpredictable distortion.
                </span>
            </div>

            <label class="control-label" for="stop_dsd_silence">停止前保持静音</label>
            <div class="controls">
				<select id="stop_dsd_silence" name="conf[stop_dsd_silence]" class="config-select-large">
					$_mpd_select[stop_dsd_silence]
				</select>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info_stop_dsd_silence" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
				<span id="info_stop_dsd_silence" class="config-help-info">
					Play silence before manually stopping or pausing DSD/DoP playback. This is a workaround for some audio devices that emit noise when stopping DSD/DoP playback.
				</span>
            </div>

			<label class="control-label" for="thesycon_dsd_workaround">Thesycon补丁</label>
            <div class="controls">
				<select id="thesycon_dsd_workaround" name="conf[thesycon_dsd_workaround]" class="config-select-large">
					$_mpd_select[thesycon_dsd_workaround]
				</select>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info_thesycon_dsd_workaround" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
				<span id="info_thesycon_dsd_workaround" class="config-help-info">
					Enable a workaround for a bug in Thesycon USB audio receivers. On these devices playing DSD512 or PCM causes all subsequent attempts to play other DSD rates to fail which can be fixed by briefly playing PCM at 44.1 kHz.
				</span>
            </div>

            <div class="config-horiz-rule">SoX重采样</div>

			<label class="control-label" for="sox-enabled">允许</label>
            <div class="controls">
                <select id="sox-enabled" name="sox_enabled" class="config-select-large">
					$_mpd_select[sox_enabled]
                </select>
                <span class="config-help-static">
                    The Selective resampling option will appear when SoX is enabled and a sample rate is specified.
                </span>
            </div>

			<label class="control-label" for="sox-bit-depth">位深</label>
            <div class="controls">
                <select id="sox-bit-depth" name="sox_bit_depth" class="config-select-large">
					$_mpd_select[sox_bit_depth]
                </select>
            </div>

            <label class="control-label" for="sox-sample-rate">采样率(kHz)</label>
            <div class="controls">
                <select id="sox-sample-rate" name="sox_sample_rate" class="config-select-large">
					$_mpd_select[sox_sample_rate]
                </select>
            </div>

            <label class="control-label" for="sox-channels">通道</label>
            <div class="controls">
                <select id="sox-channels" name="sox_channels" class="config-select-large">
					$_mpd_select[sox_channels]
                </select>
            </div>

    		<div class="$_selective_resampling_hide"> <!-- This is ment to control visibility of the feature in case MPD no longer supports the patch -->
    			<div id="selective-resample" class="hide">
	                <label class="control-label" for="selective-resample-mode">选择性重采样</label>
	                <div class="controls">
	                    <select id="selective-resample-mode" name="conf[selective_resample_mode]" class="config-select-large">
							$_mpd_select[selective_resample_mode]
	                    </select>
						<a aria-label="Help" class="config-info-toggle" data-cmd="info-selective-resample-mode" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
                        $_selective_mode_selected
						<span id="info-selective-resample-mode" class="config-help-info">
							<p>These charts show the effect of selective resampling modes for the example target rates.</p>
							<img src="images/Selective resampling chart 1.jpg" alt="Selective resampling chart 1"><br><br>
							<img src="images/Selective resampling chart 2.jpg" alt="Selective resampling chart 2"><br><br>
						</span>
	                </div>
    			</div>
    		</div>

            <label class="control-label" for="sox-quality">质量</label>
            <div class="controls">
                <select id="sox-quality" name="conf[sox_quality]" class="config-select-large">
					$_mpd_select[sox_quality]
                </select>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-sox-quality" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
				<span id="info-sox-quality" class="config-help-info config-help-no-margin">
					<b>Very high: </b>Precision 28, Phase response 50 (Linear phase), Passband end 91%, Stopband begin 100%, Attenuation 0dB.<br>
					<b>High (Default): </b>Precision 20, Phase response 50 (Linear phase), Passband end 91%, Stopband_begin 100%, Attenuation 0dB.<br>
					<b>Medium: </b>Precision 16, Phase response 50 (Linear phase), Passband end 92%, Stopband begin 100%, Attenuation 0dB.<br>
					<span class="$_sox_custom_recipe_hide">
						<b>Custom recipe: </b>Set individual parameters.
					</span>
				</span>
                <span class="config-help-static">
                    Individual quality parameters will appear when Quality is set to "Custom recipe".
                </span>
            </div>

			<div class="$_sox_custom_recipe_hide">
				<div id="sox-custom-recipe" class="hide">
					<label class="control-label" for="sox-precision">Precision</label>
	                <div class="controls">
	                    <select id="sox-precision" name="conf[sox_precision]" class="config-select-large">
							$_mpd_select[sox_precision]
	                    </select>
						<a aria-label="Help" class="config-info-toggle" data-cmd="info-sox-precision" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
						<span id="info-sox-precision" class="config-help-info">
							Default is 20 bits which corresponds to the "High quality" setting. The "Very high quality" setting uses 28 bits.
						</span>
					</div>
	                <label class="control-label" for="sox-phase-response">Phase response</label>
	                <div class="controls">
	                    <input class="config-input-large" type="number" id="sox-phase-response" name="conf[sox_phase_response]" value="$_mpd_select[sox_phase_response]" min="0" max="50">
						<a aria-label="Help" class="config-info-toggle" data-cmd="info-sox-phase-response" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
						<span id="info-sox-phase-response" class="help-block-configs help-block-margin3 hide">
							Range is 0 to 50 where 0 = minimum phase, 25 = intermediate phase and 50 = linear phase. Default is 50.
	                    </span>
	                </div>
	                <label class="control-label" for="sox-passband-end">Passband end (%)</label>
	                <div class="controls">
	                    <input class="config-input-large" type="number" id="sox-passband-end" name="conf[sox_passband_end]" value="$_mpd_select[sox_passband_end]" min="80" max="100" step="0.1">
						<a aria-label="Help" class="config-info-toggle" data-cmd="info-sox-passband-end" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
						<span id="info-sox-passband-end" class="help-block-configs help-block-margin3 hide">
							Original bandwidth of source used. Range is 80 to 100% where 100% represents the Nyquist frequency. Default is 95%.
	                    </span>
	                </div>
	                <label class="control-label" for="sox-stopband-begin">Stopband begin (%)</label>
	                <div class="controls">
	                    <input class="config-input-large" type="number" id="sox-stopband-begin" name="conf[sox_stopband_begin]" value="$_mpd_select[sox_stopband_begin]" min="100" max="200" step="0.1">
						<a aria-label="Help" class="config-info-toggle" data-cmd="info-sox-stopband-begin" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
						<span id="info-sox-stopband-begin" class="help-block-configs help-block-margin3 hide">
							A percentage greater than or equal to 100. Default is 100% which represents the Nyquist frequency.
	                    </span>
	                </div>
	                <label class="control-label" for="sox-attenuation">Attenuation (dB)</label>
	                <div class="controls">
	                    <input class="config-input-large" type="number" id="sox-attenuation" name="conf[sox_attenuation]" value="$_mpd_select[sox_attenuation]" min="0" max="24" step="0.1">
						<a aria-label="Help" class="config-info-toggle" data-cmd="info-sox-attenuation" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
						<span id="info-sox-attenuation" class="help-block-configs help-block-margin3 hide">
							Reduce the amplitude of the source to prevent clipping. Range is 0 to 24dB. Default is 0dB.
	                    </span>
	                </div>
	                <label class="control-label" for="sox-flags">Flags</label>
	                <div class="controls">
						<input class="config-input-large" type="number" id="sox-flags" name="conf[sox_flags]" value="$_mpd_select[sox_flags]">
						<a aria-label="Help" class="config-info-toggle" data-cmd="info-sox-flags" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
						<span id="info-sox-flags" class="help-block-configs help-block-margin3 hide">
							Bit mask for setting special SoX options.<br>
							00 ROLLOFF_SMALL 0.01 dB<br>
							01 ROLLOFF_MEDIUM 0.35 dB<br>
							02 ROLLOFF_NONE For Chebyshev bandwidth.<br>
							08 HI_PREC_CLOCK Increase "irrational" ratio accuracy.<br>
							16 DOUBLE_PRECISION Use DP calcs even if precision &lt;= 20<br>
							32 SOXR_VR Variable-rate resampling.
	                    </span>
	                </div>
				</div>
			</div>

            <label class="control-label" for="sox-multithreading">多线程</label>
            <div class="controls">
                <select id="sox-multithreading" name="conf[sox_multithreading]" class="config-select-large">
					$_mpd_select[sox_multithreading]
                </select>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-sox-multithreading" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
				<span id="info-sox-multithreading" class="config-help-info">
                    Run SoX in multiple threads for improved efficiency.<br>
				</span>
            </div>

            <div class="config-horiz-rule">增益和归一化</div>

            <label class="control-label" for="replaygain">回放增益</label>
            <div class="controls">
				<select id="replaygain" name="conf[replaygain]" class="config-select-large">
					$_mpd_select[replaygain]
				</select>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-replaygain" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
				<span id="info-replaygain" class="config-help-info">
					Adjust the volume of songs played using ReplayGain tags. Setting this to "album" will adjust volume using the album's ReplayGain tags, while setting it to "track" will	adjust it using the track ReplayGain tags. Setting it to "auto" uses the track ReplayGain tags if MPD random play is activated otherwise the album ReplayGain tags. Currently only FLAC, Ogg Vorbis, Musepack, and MP3 (through ID3v2 ReplayGain tags, not APEv2) are supported.
               </span>
            </div>

            <label class="control-label" for="replaygain-preamp">ReplayGain preamp</label>
            <div class="controls">
                <input class="config-input-large" type="number" id="replaygain-preamp" name="conf[replaygain_preamp]" value="$_mpd_select[replaygain_preamp]" min="-15" max="15">
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-replaygain-preamp" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
				<span id="info-replaygain-preamp" class="config-help-info">
					The gain (in dB) applied to songs with ReplayGain tags. Range is -15 to 15.
                </span>
            </div>

            <label class="control-label" for="volume-normalization">归一化音量</label>
            <div class="controls">
				<select id="volume-normalization" name="conf[volume_normalization]" class="config-select-large">
					$_mpd_select[volume_normalization]
				</select>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-volume-normalization" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
				<span id="info-volume-normalization" class="config-help-info">
					Adjust the volume of songs as they play so that they sound as though they are of equal loudness.
					Note that output bit depth will be converted to 16 bit.
				</span>
            </div>

            <div class="config-horiz-rule">优化资源配置</div>

            <label class="control-label" for="audio-buffer-size">Audio buffer (MB)</label>
            <div class="controls">
                <input class="config-input-large" type="number" id="audio-buffer-size" name="conf[audio_buffer_size]" value="$_mpd_select[audio_buffer_size]" min="4" max="64">
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-audio-buffer-size" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
				<span id="info-audio-buffer-size" class="config-help-info">
                	Size of the buffer for audio samples. Range is 4 to 64MB. Default size is 4MB.
                </span>
            </div>

			<label class="control-label" for="max_output_buffer_size">Output buffer (MB)</label>
            <div class="controls">
                <input class="config-input-large" type="number" id="max_output_buffer_size" name="conf[max_output_buffer_size]" value="$_mpd_select[max_output_buffer_size]" min="8" max="512">
				<a aria-label="Help" class="config-info-toggle" data-cmd="info_max_output_buffer_size" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
				<span id="info_max_output_buffer_size" class="config-help-info">
                	Size of the buffer for command output. Range is 8 to 512MB. Default is 128MB.
                </span>
            </div>

			<label class="control-label" for="max_playlist_length">Max Queue items</label>
            <div class="controls">
                <input class="config-input-large" type="number" id="max_playlist_length" name="conf[max_playlist_length]" value="$_mpd_select[max_playlist_length]" min="2" max="32768">
				<a aria-label="Help" class="config-info-toggle" data-cmd="info_max_playlist_length" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
				<span id="info_max_playlist_length" class="config-help-info">
                	Range is 2 to 32768 Queue items. Default is 16384 items.
                </span>
            </div>

			<label class="control-label" for="input_cache">Input cache</label>
			<div class="controls">
				<select id="input_cache" name="conf[input_cache]" class="config-select-large">
					$_mpd_select[input_cache]
				</select>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-input-cache" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
				<span id="info-input-cache" class="config-help-info">
					The input cache prefetches queued song files into memory before they are going to be played. If the cache grows larger than the specified size, older files will be evicted.
			   </span>
			</div>

            <div class="config-horiz-rule">HTTP Proxy</div>

            <label class="control-label" for="proxy-server">Server</label>
            <div class="controls">
                <input class="config-input-large" type="text" id="proxy-server" name="conf[proxy]" value="$_mpd_select[proxy]">
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-proxy-server" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
				<span id="info-proxy-server" class="config-help-info">
                	Specify the address of the HTTP proxy server for example proxy.isp.com:8080
                </span>
            </div>

			<label class="control-label" for="proxy-user">用户</label>
            <div class="controls">
                <input class="config-input-large" type="text" id="proxy-user" name="conf[proxy_user]" value="$_mpd_select[proxy_user]">
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-proxy-user" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
				<span id="info-proxy-user" class="config-help-info">
                    Specify the userid used to authenticate to the proxy server.
                </span>
            </div>

            <label class="control-label" for="proxy-password">密码</label>
            <div class="controls">
                <input class="config-input-large" type="password" id="proxy-password" name="conf[proxy_password]" value="$_mpd_select[proxy_password]">
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-proxy-password" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
                <a class="show-hide-password" href="#notarget" data-id="proxy-password"><i class="fa-regular fa-sharp fa-eye"></i></a>
				<span id="info-proxy-password" class="config-help-info">
                    Specify the password used to authenticate to the proxy server.
                </span>
            </div>

            <div class="config-horiz-rule">其它配置</div>

            <label class="control-label" for="log_level">日志标准</label>
            <div class="controls">
				<select id="log_level" name="conf[log_level]" class="config-select-large">
					$_mpd_select[log_level]
				</select>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-log_level" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
				<span id="info-log_level" class="config-help-info">
					Control the amount of detail in the MPD log (/var/log/mpd/log).
               </span>
            </div>

            <label class="control-label" for="buffer-time">Device buffer (ms)</label>
            <div class="controls">
				<select id="buffer-time" name="conf[buffer_time]" class="config-select-large">
					$_mpd_select[buffer_time]
				</select>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-buffer-time" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
				<span id="info-buffer-time" class="config-help-info">
					Device sample buffer length in milliseconds.
				</span>
            </div>

            <label class="control-label" for="period-time">Device period (ms)</label>
             <div class="controls">
 				<input class="config-input-large" type="number" id="period-time" name="conf[period_time]" value="$_period_time" readonly>
 				<a aria-label="Help" class="config-info-toggle" data-cmd="info-period-time" href="#notarget"><i class="fa-regular fa-sharp fa-info-circle"></i></a>
 				<span id="info-period-time" class="config-help-info">
                    The time in milliseconds between sample transfers to the host (calculated as device_buffer_length / 4).
 				</span>
             </div>
        </div>
    </form>
</div>
</div>
